package cc.laop.controller.system;

import cc.laop.business.system.ConfigBusiness;
import cc.laop.entity.system.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("admin/system/config")
public class ConfigController {

	@Autowired
	private ConfigBusiness configBusiness;

	@RequestMapping("list.do")
	@ResponseBody
	public Map<String, Object> list() {
		Map<String, Object> map = new HashMap<String, Object>();
		List<Config> list = configBusiness.select(new Config());
		map.put("configlist", list);
		return map;
	}

	@RequestMapping("edit.do")
	@ResponseBody
	public Map<String, Object> edit(@RequestBody List<Config> list) {
		Map<String, Object> map = new HashMap<String, Object>();
		configBusiness.update(list);
		map.put("result", "1");
		return map;
	}
}
